fast method to compute determinant